package com.xiaomaoguai.observer.jdk;

import java.util.Observer;

/**
 * @ FileName: Test.java
 * @ Author: WeiHui-Z
 * @ Date: 2017/4/25 15:06
 * @ Version: v1.0.0
 */
public class Test {

    public static void main(String[] args) {
        //创建被观察者对象
        Watched watched = new Watched();
        //创建观察者对象，并将被观察者对象登记
        Observer watcher = new Watcher(watched);
        //给被观察者状态赋值
        watched.setData("start");
        watched.setData("run");
        watched.setData("stop");
    }

}
